﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace CinemabookingWCFApp.RowsFolder
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "RowsService" in code, svc and config file together.
    // NOTE: In order to launch WCF Test Client for testing this service, please select RowsService.svc or RowsService.svc.cs at the Solution Explorer and start debugging.
    public class RowsService : IRowsService
    {
        #region
        CinemabookingDBDataContext db = new CinemabookingDBDataContext();
        #endregion

        public List<TheaterRow> GetAllRows()
        {
            var queryResult = (from x in db.TheaterRows
                               select x);
            return queryResult.ToList();
        }

        public List<TheaterRow> GetRow(int Rownr)
        {
            var queryResult = (from x in db.TheaterRows
                               where x.rowNumber == Rownr
                               select x);
            return queryResult.ToList();
        }

        public List<TheaterRow> GetRowsInTheater(int TheaterId)
        {
            var queryResult = (from x in db.TheaterRows
                               where x.theaterId == TheaterId
                               select x);
            return queryResult.ToList();
        }

    }
}
